* dispnew.c (clear_glyph_row, copy_row_except_pointers):
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 24 Sep 2013 07:16:38 +0000 (00:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 24 Sep 2013 07:16:38 +0000 (00:16 -0700)
Prefer signed to unsigned integers where either will do.
No need for 'const' on locals that do not escape.
Omit easserts with unnecessary and unportable assumptions about
alignment.  Avoid unnecessary casts to char *.

src/ChangeLog
src/dispnew.c

index 19993be94f10d5f2d3e80d0168b96a7ee0e760ec..7406b1e9ec4e2856a3ec2e2bc697547cfc51db59 100644 (file)
@@ -1,3 +1,11 @@
+2013-09-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * dispnew.c (clear_glyph_row, copy_row_except_pointers):
+       Prefer signed to unsigned integers where either will do.
+       No need for 'const' on locals that do not escape.
+       Omit easserts with unnecessary and unportable assumptions about
+       alignment.  Avoid unnecessary casts to char *.
+
 2013-09-24  Dmitry Antipov  <dmantipov@yandex.ru>
 
        Use union for the payload of struct Lisp_Vector.
index f7e3fa5444152ee56ca7442041e0aedb1a9fe483..f9132f37f68593be6be7574216ad64eaf00b6104 100644 (file)
@@ -838,11 +838,10 @@ clear_window_matrices (struct window *w, bool desired_p)
 void
 clear_glyph_row (struct glyph_row *row)
 {
-  const size_t off = offsetof (struct glyph_row, used);
+  int off = offsetof (struct glyph_row, used);
 
-  eassert (off == sizeof row->glyphs);
   /* Zero everything except pointers in `glyphs'.  */
-  memset ((char *) row + off, 0, sizeof *row - off);
+  memset (row->used, 0, sizeof *row - off);
 }
 
 
@@ -989,10 +988,9 @@ swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b)
 static void
 copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from)
 {
-  const size_t off = offsetof (struct glyph_row, x);
+  int off = offsetof (struct glyph_row, x);
 
-  eassert (off == sizeof to->glyphs + sizeof to->used + sizeof to->hash);
-  memcpy ((char *) to + off, (char *) from + off, sizeof *to - off);
+  memcpy (&to->x, &from->x, sizeof *to - off);
 }